package com.tiancheng.trade.settlement.service.settlement.impl;

import com.tiancheng.trade.settlement.configuration.CmbConfiguration;
import com.tiancheng.trade.settlement.service.settlement.ICmbSignService;
import com.tiancheng.trade.settlement.util.SignUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 招商银行签名服务
 *
 * @author su
 */
@Slf4j
@Component
public class CmbSignService implements ICmbSignService {

    @Autowired
    CmbConfiguration cmbConfiguration;

    /**
     * 签名
     *
     * @param content 内容
     * @return
     */
    public String sign(String content) {
        String privateKey = SignUtils.getKey(cmbConfiguration.getAppKeyPath());
        String sign = SignUtils.sign(content, privateKey, true);
        return sign;
    }

}
